package sanglh.edu.hsphysics.utils;

import android.content.Context;
import android.content.pm.PackageManager;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;

public final class DeviceUtils {
	// =========================================================================================================

	public static String getUID(Context context) {
		TelephonyManager mTeleMan = (TelephonyManager) context
				.getSystemService(Context.TELEPHONY_SERVICE);
		String UID = mTeleMan.getDeviceId();

		if (TextUtils.isEmpty(UID)) {
			WifiManager manager = (WifiManager) context
					.getSystemService(Context.WIFI_SERVICE);
			WifiInfo info = manager.getConnectionInfo();

			UID = info.getMacAddress();
		}
		return TextUtils.isEmpty(UID) ? "<Unknown>" : UID;
	}
	public static boolean hasSDCard() {
		return android.os.Environment.getExternalStorageState().equals(
				android.os.Environment.MEDIA_MOUNTED);
	}
	public static boolean hasCamera(Context context) {
		PackageManager packageManager = context.getPackageManager();
		return packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA)
				|| packageManager
						.hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT);
	}

}